package com.yricky.indesk.a.receiver

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import com.yricky.indesk.utils.TimeEvent
import com.yricky.indesk.utils.minuteTimerChannel

/**
 * @author Yricky
 * @date 2022/1/17
 */
class TimeTickReceiver:BroadcastReceiver() {
    fun init(context: Context){
        val intentFilter = IntentFilter()
        intentFilter.addAction(Intent.ACTION_TIME_TICK);
        context.registerReceiver(this, intentFilter)
    }

    override fun onReceive(context: Context?, intent: Intent?) {
        minuteTimerChannel.post(TimeEvent)
    }
}